package com.gitee.cashzhang27.test.boot.other.config;

import com.gitee.cashzhang27.test.boot.other.intercept.AdminLoginIntercept;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author cash Zhang
 * @since 2019/02/18 16:21
 */
@Configuration
public class MyWebMvcConfigurer implements WebMvcConfigurer {

  @Override
  public void addInterceptors(InterceptorRegistry registry) {
    // 添加一个拦截器，连接以/admin为前缀的 url路径
    registry.addInterceptor(new AdminLoginIntercept()).addPathPatterns("/admin/**");
  }
}
